package com.wxy.demo.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

/**
 * @Author wxy
 * @Date 19-8-19 上午9:59
 * @Description TODO
 **/
@Data
@Entity
@Table(name = "jpa_user")
@NoArgsConstructor
@Accessors(chain = true)
@DynamicInsert
@DynamicUpdate
public class User {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column
    private String userName;

    @Column(columnDefinition = "varchar(255) comment '居住地址'")
    private String homeAddress;

    private Long homeTel;

    @Column(columnDefinition = "varchar(255) comment '邮箱'")
    private String email;

    @Column(columnDefinition = "int(4) default 0 comment '排序'")
    private Integer sort;

    private Integer status;

    public User(String userName, String email) {
        this.userName = userName;
        this.email = email;
    }
}